<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="/static/lib/layui/css/layui.css">
  <link rel="stylesheet" href="/static/css/index.css">
  <script src="/static/lib/layui/layui.js"></script>
  <script src="/static/js/jquery.min.js"></script>
</head>
<body>
  <div class="container">
    <form class="container_form" action="/getReptile">
      <div class="container_item">
        <span>查询地址</span>
        <input type="text" name="path" class="path" value="" >
      </div>
      <div class="container_item02">
        <span>页数</span>
        <input type="text" name="page" value="1" placeholder="开始页数">
        <p>~</p>
        <input type="text" name="limit" value="5" placeholder="结束页数">
      </div>
      <div class="container_item">
        <span>关键字</span>
        <input type="text" style="width: 200px;" name="keyword" value="" placeholder="默认为空">
      </div>
      <div class="container_item03">
        <span>网站类型</span>
        <select name="type" class="form_select" onchange="type_change(this.options.selectedIndex)">
          <option value="1" data-url="http://b2b.eie.cn/home/Search/index.html">赣企在线</option>
          <option value="2" data-url="https://movie.douban.com/top250">豆瓣</option>
          <!-- <option value ="3" data-url="https://s.taobao.com/search">淘宝</option> -->
        </select>
      </div>
      <div class="container_item">
        <span>并发数</span>
        <input type="text" name="bf" style="width: 100px;" value="5">
      </div>
      <div class="container_btn">
        <button class="btn" type="submit" onclick="start()">开始</button>
        <button class="btn02" type="button" onclick="goview()">查看数据</button>
      </div>
    </form>
  </div>

  <script>
    var d = document.createElement("div")
    d.innerHTML = "{{data}}"

    console.log(JSON.parse(d.innerHTML))

    type_change(0)
    function type_change(i) {
      var path = $(".form_select option").eq(i)[0].dataset.url
      $(".path").val(path)
      // console.log(i,$(".form_select option").eq(i).val())
    }

    function goview(){
      var type = $(".form_select option:selected").val()
      var path = $(".path").val()
      console.log(type,path)
      window.location.href = "/getReptile02.html?type=" + type + "&path=" + path;
    }

    function start() {
      $(".btn").html("查询中...")
    }
  </script>
</body>
</html>